<template>
	<view class="container">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">心理量表</block>
		</cu-custom>
		
		<view class="bannerBox">
			<image mode="widthFix" src="http://cdn.zhoukaiwen.com/Banner4.jpg"></image>
		</view>
		
		<view>
			<view class="cu-bar bg-white margin-top-xs">
				<view class="action sub-title">
					<text class="text-xl text-bold text-blue text-shadow">心理量表</text>
					<text class="text-ABC text-blue">psychology</text>
				</view>
			</view>
			<view v-for="(item1, index1) in dataL">
			<view v-for="(item, index) in item1" class="cu-list menu sm-border margin-bottom ">
				<view class="cu-item">
					<view class="content padding-tb-sm">
						<view class="text-xl">
							<text class="cuIcon-text text-blue margin-right-xs"></text>
							{{item.name}}
						</view>
						<view class="text-gray text-df margin-top-xs">
							<text class="cuIcon-hotfill margin-right-xs"></text>
							已有{{item.num}}位用户已答题
							<view @click="goExplain(item.id)">
								<u-icon name="question-circle-fill" size="30"></u-icon>
									点击查看量表介绍
							</view>
						</view>
					</view>
					<view class="action">
						<button v-if="item.isAnswer != 2" @click="goIndex(item.id)" class="cu-btn round bg-gradual-blue shadow">前往答题</button>
						
						<button v-if="item.isAnswer == 2" @click="goIndex(item.id)" class="cu-btn round bg-gradual-orange shadow">已经答题</button>
					</view>
				</view>
			</view>
			</view>

			
		</view>
			<view style="height: 140rpx;width: 1rpx;"></view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				idd:"",
				dataL: {
					data1: [{
							id: '1',
							name: '匹兹堡睡眠质量指数（PSQI）',
							num:'31',
							isAnswer: 1
					}],
					data2: [{
							id: '2',
							name: '广泛性焦虑量表(GAD-7)',
							num:'48',
							isAnswer: 1
					}],
					data3: [{
							id: '3',
							name: '患者健康问卷抑郁量表(PHQ-9)',
							num:'48',
							isAnswer: 1
					}],
					data4: [{
							id: '4',
							name: '反刍思维量表',
							num:'481',
							isAnswer: 1
					}],
					data5: [{
							id: '5',
							name: '应激感受量表（PSS-10）',
							num:'238',
							isAnswer: 1
					}],
					data6: [{
							id: '6',
							name: '宾州担忧问卷（PSWQ）',
							num:'48',
							isAnswer: 1
					}],
					data7: [{
							id: '7',
							name: '前瞻回溯记忆问卷（PRMQ）',
							num:'22',
							isAnswer: 1
					}],
					data8: [{
							id: '8',
							name: '生命质量核心量表QLQ-C30(v3.0)',
							num:'11',
							isAnswer: 1
					}],data9: [{
							id: '9',
							name: '症状自评量表SCL-90(v3.0)',
							num:'11',
							isAnswer: 1
					}]
				
				
				},
			};
		},
		onLoad(options) {
			console.log(this.dataL)
		    // options 是一个对象，包含传递的所有参数
		    const idd = options.id;  // 获取传递的 id 参数
		    console.log('传递过来的 id:', idd);
			this.idd=idd
		},
		watch: {
			
		},
		methods: {
			goExplain(id) {
				uni.navigateTo({
					url: './explain?id='+id
				});
			},
			goIndex(id){
		
			if(id==1){
				// console.log(id)
				uni.navigateTo({
					url: '/pages/me/mentalTest/psqi?id='+this.idd
				})
			}
				if(id==2){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/gad7?id='+this.idd
					})
				}
				if(id==3){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/phq9?id='+this.idd
					})
				}
				if(id==4){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/fz?id='+this.idd
					})
				}
				if(id==5){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/pss10?id='+this.idd
					})
				}
				if(id==6){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/pswq?id='+this.idd
					})
				}
				if(id==7){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/prmq?id='+this.idd
					})
				}
				if(id==8){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/qlqc30?id='+this.idd
					})
				}
				if(id==9){
					console.log(id)
					uni.navigateTo({
						url: '/pages/me/mentalTest/scl90?id='+this.idd
					})
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	.container {
		background-color: #f2f2f2;
		width: 100%;
		height: 100%;

		.bannerBox {
			width: 100%;

			image {
				width: 100%;
			}
		}
	}
</style>
